<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>sub-process</title>
    <style type="text/css">
        a, button {
            margin: 5px;
        }

        .title, .select {
            background: #C4E3FD;
            width: 100%;
            height: 35px;
            position: fixed;
            top: 0;
        }

        .select {
            background: #ffffff;
            top: 0px;
            display: flex;
        }

        .select .inps {
            flex: 1;
        }

        .select .inpQuery {
            width: 50px;
        }
    </style>
</head>
<body id="bodyId" style="border: 0; padding: 0;margin:0;overflow-x: hidden;overflow-y: hidden;">

<h3>主子进程独立示例</h3>

<button onclick="emitRenderIPC()">触发渲染进程IPC</button>
<br>
<a target="_blank" href="index.html">新窗口</a>
<a href="https://www.baidu.com">百度一下</a>
<br>
<div id="test" style="width: 100%;border: solid 1px red;min-height: 100px;"></div>

<script>
    function emitRenderIPC() {
        ipc.emit({
            name: "sub-process-on-event",                 //事件名
            arguments: ["energy"],          //参数
            callback: function (r1) {               //回调函数
                alert("result: "+ r1)
            },
            mode: 0, // int 0:async or 1:sync, default 0:async  触发模式、异步和同步
            target: 1, // int 0:main 1:current 2:other  触发目标, 主进程、当前进程、其它进程(需要主进程)
        })
    }


</script>
</body>
</html>